<template>
  <div>
    <p>当前计数：{{ count }}</p>
    <button @click="add">加1</button>
  </div>
</template>

<script setup lang="ts">
import { defineEmits, ref } from 'vue'

const count = ref(1)
const add = () => {
  count.value++
  emit('updateCount', count.value)
}
const emit = defineEmits<{
  (e: 'updateCount', value: number): void
}>()
</script>

<style scoped></style>
